

import { observable, action } from 'mobx'
import { ajax } from '../../api'

class Active {
    // 订单列表
    @observable activelist: Array<object> = []
    // 异步
    @action cactive = async (payload:any) => {
        let { code, result }: any = await ajax.activelist(payload)
        if (code === 200) {
            result.map((v:any)=>{
                let str1 = v.ValidTime[0]
                let str2 = v.ValidTime[1]
                let dateStr = str1.split('T')[0]
                let dateEnd = str2.split('T')[0]
                v.ValidTime = dateStr + "/" + dateEnd
                return v
            })
            this.activelist = result;
        }
    }
    // 查询
    @action sactivelist = async (payload: any) => {
        let { code, result }: any = await ajax.activelist(payload)
        if (code === 200) {
            this.activelist = result;
        }
    }

    // 同步
    @action getactivelist = (payload:any)=>{
        this.activelist = payload
    }
}
export default new Active()